package com.focusai.efairy.model.request;

import com.focusai.efairy.model.base.UpLoadBaseEntity;
import com.focusai.efairy.model.warn.UpLoadAlarmItem;
import com.focusai.efairy.network.Response;
import com.focusai.efairy.network.exception.ParseException;
import com.focusai.efairy.network.request.base.PureJSONRequest;
import com.focusai.efairy.network.utils.UrlUtils;
import com.focusai.efairy.utils.GsonHelper;

import org.json.JSONException;

import java.util.Map;

/**
 * Created by luo_guangwen on 2017/9/18.
 */

public class PostInputAlarmRequest extends PureJSONRequest<String> {

    private UploadEntry uploadEntry;
    public PostInputAlarmRequest(UpLoadAlarmItem upLoadAlarmItem, Response.Listener<String> listener) {
        super(UrlUtils.createUrl("/appapi/alarmrecord"), listener);
        this.uploadEntry = new UploadEntry();
        this.uploadEntry.efairyalarmrecord_info = upLoadAlarmItem;
    }

    @Override
    protected String parse(String result) throws ParseException {
        return result;
    }

    @Override
    public Map<String, String> getParams() throws JSONException {
        return super.getParams();
    }

    @Override
    public String getPureJSON() throws JSONException {
        return GsonHelper.getInstance().toJson(uploadEntry);
    }

    private static class UploadEntry extends UpLoadBaseEntity{
        public UpLoadAlarmItem efairyalarmrecord_info;
    }
}


